import pymysql


# 定义一个连接数据库的类
class Mydb():
    def __init__(self, host, user, password, database, port):
        self.con = pymysql.connect(host=host, user=user, password=password, database=database, port=int(port))
        self.cur = self.con.cursor()

    def seatch(self, spl):
        self.cur.execute(spl)
        return self.cur.fetchall()
    def close(self):
        self.cur.close()
        self.con.close()



